package cn.bugstack.domain.trade.service.settlement.filter;

import cn.bugstack.domain.trade.model.entity.GroupBuyTeamEntity;
import cn.bugstack.domain.trade.model.entity.TradeLockRuleFilterBackEntity;
import cn.bugstack.domain.trade.model.entity.TradeSettlementRuleCommandEntity;
import cn.bugstack.domain.trade.model.entity.TradeSettlementRuleFilterBackEntity;
import cn.bugstack.domain.trade.service.settlement.factory.TradeSettlementRuleFilterFactory;
import cn.bugstack.types.design.framework.link.model2.ILogicHandler;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.BeanUtils;
import org.springframework.stereotype.Service;

/**
 * @Author: 代码的路
 * @Date: 2025/3/5 09:53
 * @Param:
 * @Return:
 * @Description:
 **/
@Slf4j
@Service
public class EndRuleFilter  implements ILogicHandler<TradeSettlementRuleCommandEntity, TradeSettlementRuleFilterFactory.DynamicContext, TradeSettlementRuleFilterBackEntity> {

    @Override
    public TradeSettlementRuleFilterBackEntity apply(TradeSettlementRuleCommandEntity requestParameter, TradeSettlementRuleFilterFactory.DynamicContext dynamicContext) {
        log.info("结算规则过滤-结束节点 outTradeNo:{}", requestParameter.getOutTradeNo());
        GroupBuyTeamEntity groupBuyTeamEntity = dynamicContext.getGroupBuyTeamEntity();
        TradeSettlementRuleFilterBackEntity tradeSettlementRuleFilterBackEntity = new TradeSettlementRuleFilterBackEntity();
        BeanUtils.copyProperties(groupBuyTeamEntity,tradeSettlementRuleFilterBackEntity);
        return tradeSettlementRuleFilterBackEntity;
    }
}